

import React, { useState } from 'react'
import { Carousel, Image } from 'antd'
import { articleListItem, IArticleItem } from '@/types';


const Swiper = (props: { imgSrc: IArticleItem[]; }) => {
    return (
        <Carousel autoplay={5000} >
            {
               props.imgSrc && props.imgSrc.length ? props.imgSrc.map((item: articleListItem) => {
                    return <div key={item.id}>
                        <div className='mask_sw'>
                            <h1>{item.title}</h1>
                            <p>
                                大约 6个月前 · {item.views} 次阅读
                            </p>
                        </div>
                        <Image src={item.cover} preview={false}> </Image>
                    </div>
                }):<div>暂无数据</div>
            }
            
        </Carousel>
    )
}
export default Swiper